package com.pbking.facebook.delegates.feed
{
	import com.pbking.facebook.Facebook;
	import com.pbking.facebook.data.feed.TemplateBundle;
	import com.pbking.facebook.delegates.FacebookDelegate;

	/**
	 * example json return value from facebook: 
	 * [{"one_line_story_templates":["{*actor*}test"],"short_story_templates":[{"template_title":"{*actor*}test short","template_body":""}],"time_created":1219783291,"template_bundle_id":31983956677},{"one_line_story_templates":["{*actor*} did this"],"short_story_templates":[{"template_title":"{*actor*} did this in short stories","template_body":""}],"full_story_template":{"template_title":"{*actor*} did this in full story","template_body":"{*actor*} did this in full story again"},"time_created":1219714307,"template_bundle_id":31863366677}]
	 * 
	 * @author sol wu
	 * @see http://wiki.developers.facebook.com/index.php/Feed.getRegisteredTemplateBundleByID
	 */
	public class GetRegisteredTemplateBundlesDelegate extends FacebookDelegate
	{
		public var bundles:Array = [];
		
		public function GetRegisteredTemplateBundlesDelegate(facebook:Facebook)
		{
			super(facebook);
			fbCall.post("facebook.feed.getRegisteredTemplateBundles");
		}

		override protected function handleResult(result:Object):void
		{
			for each (var bundleObj:Object in result)
			{
				var bundle:TemplateBundle = new TemplateBundle(bundleObj);
				bundles.push(bundle);
			}
		}
		
	}
	
}